﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Touch2Like.Model;
using Touch2Like.SharedLibrary;

namespace Touch2Like.Web.Customer
{
    public partial class active : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["u"]) && !string.IsNullOrEmpty(Request["t"]))
            {
                Touch2Like.DAL.UserDAL user = new Touch2Like.DAL.UserDAL();
                UserInfo info = user.GetUserByNameAndEmail(GlobalManager.RetrieveUserType.Username, Request["u"].Trim());

                if (info != null && Request["t"].Trim() == Utility.Encryption.Encrypt(Request["u"].Trim()))
                {
                    info.Active = 1;
                    //user.Update(info);  Need to implement. 

                    lb_Msg.Text = "Your account has been activated.";
                    return;
                }
            }

            lb_Msg.Text = "Operation failed.";
        }
    }
}